package cn.wolfcode.service.impl;

import cn.wolfcode.domain.Role;
import cn.wolfcode.mapper.RoleMapper;
import cn.wolfcode.qo.QueryObject;
import cn.wolfcode.service.IRoleService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role>  implements IRoleService {
    @Autowired
    private RoleMapper roleMapper;

    @Override
    public Page<Role> queryPage(QueryObject qo) {
        Page<Role> page = new Page<>(qo.getCurrentPage(),qo.getPageSize());
        QueryWrapper<Role> wrapper = new QueryWrapper<>();
        return super.page(page,wrapper);
    }

    @Override
    public List<Role> selectEmpAndRole(Long empId) {
        return roleMapper.selectEmpAndRole(empId);
    }
}
